using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameVuTru.ManagerScreens;
using GameVuTru.ResourceManager;

namespace GameVuTru.GameObject
{
    public class BackGround : CObject
    {
        private Vector2 postion2;
        private CSprite sprite;
        public BackGround()
        {
            postion = new Vector2(400, 240);
            postion2 = new Vector2(400, -240);
            speed = 2;
            isvisible = true;
            m_sprite = new CSprite(ReSouce.background, 1, 1, 800, 480);
            sprite = new CSprite(ReSouce.background, 1, 1, 800, 480); ;
        }
        public BackGround(Texture2D text,int sped)
        {
            postion = new Vector2(400, 240);
            postion2 = new Vector2(400, -240);
            speed = sped;
            isvisible = true;
            m_sprite = new CSprite(text, 1, 1, 800, 480);
            sprite = new CSprite(text, 1, 1, 800, 480); ;
        }
        public BackGround(int speedy)
        {
            postion = new Vector2(400, 240);
            postion2 = new Vector2(400, -240);
            this.speed = speedy;
            isvisible = true;
            m_sprite = new CSprite(ReSouce.background, 1, 1, 800, 480);
            sprite = new CSprite(ReSouce.background, 1, 1, 800, 480); ;
        }
        //load content
        public override void Update(GameTime gametime)
        {
            base.Update(gametime);
            postion.Y += speed;
            postion2.Y += speed;
            if (postion.Y > 720)
            {
                postion.Y = 240;
                postion2.Y = -240;
            }
            m_sprite.UpdateSprite();
            sprite.UpdateSprite();

        }
        public override void Draw(SpriteBatch sp)
        {
            base.Draw(sp);
            sprite.DrawSprite(sp, postion2);
        }

    }
}
